<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$title}</title>
    <meta name="keywords" content="{$title}">
    <meta name="description" content="{$title}">
    <link href="__ADMINCSS__/bootstrap.min14ed.css" rel="stylesheet">
    <link href="__ADMINCSS__/style.min.css" rel="stylesheet">
    <link href="__ADMINCSS__/plugins/switchery/switchery.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加后台管理员</h5>
                    <div class="ibox-tools">
                    </div>
                </div>
                <div class="ibox-content">
                    <form method="post" id="form1" name="form1" class="form-horizontal" action="">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">管理员账号：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="account" name="account">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">管理员角色：</label>
                            <div class="col-sm-10">
                                <select class="form-control" name="group_id" id="group_id">
                                    <option value="">==请选择角色==</option>
                                    <foreach name="group_info" item="v" key="k">
                                        <option value="{$k}">{$v}</option>
                                    </foreach>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">登录密码：</label>
                            <div class="col-sm-10">
                                <input type="password" class="form-control" name="password" id="password">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">真实姓名：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="real_name" id="real_name">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">电话：</label>
                            <div class="col-sm-10">
                                <input type="telephone" class="form-control" name="tel" id="tel">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">状态：</label>
                            <div class="col-sm-10">
                                <input type="checkbox" name="status" value="0" class="js-switch" checked> 正常
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">添 加</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__ADMINJS__/jquery.min.js"></script>
<script src="__ADMINJS__/jquery.form.js"></script>
<script src="__ADMINJS__/plugins/switchery/switchery.js"></script>
<script src="__ADMINJS__/plugins/layer/layer.min.js"></script>
<script src="__ADMINJS__/common.js"></script>
<script>
    $(function(){
        $('#form1').ajaxForm({
            beforeSubmit: checkFun,
            success: complete,
            dataType: 'json'
        });
        function checkFun(){
            if($('#account').val() == ''){
                sxshop.error('用户名不能为空！');
                return false;
            }
            if($('#group_id').val() == ''){
                sxshop.error('请选择用户组！');
                return false;
            }
            if($('#password').val() == ''){
                sxshop.error('密码不能为空！');
                return false;
            }
            if($('#real_name').val() == ''){
                sxshop.error('用户姓名不能为空！');
                return false;
            }
        }
        function complete(data){
            if(data.state > 0){
                sxshop.error(data.msg);
                return false;
            }else{
                sxshop.success(data.msg,'{:U("index")}')
            }
        }
        var elem = document.querySelector('.js-switch');
        var init = new Switchery(elem,{ size: 'small', jackColor: '#9decff' });
    })
</script>
</body>
</html>
